package com.cakin.javademo;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName: DateDemo4
 * @Description: sleep测试 和 时间测试
 * @Date: 2020/6/16
 * @Author: cakin
 */
public class DateDemo4 {
    public static void main(String[] args) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        long startTime = System.currentTimeMillis();
        Date date1 = new Date();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        Date date2 = new Date();
        long endtime =System.currentTimeMillis();

        System.out.println(simpleDateFormat.format(date1));
        System.out.println(simpleDateFormat.format(date2));
        System.out.println((endtime - startTime));

    }
}
